package blocksim.hash;

/**
 * Hash function strategy to be applied over an array of bytes
 * 
 * @author marcus
 */
public interface HashStrategy {

  /**
   * Update by pushing new bytes into the data buffer
   * 
   * @param bytes New bytes to add
   */
  public void pushBytes(byte[] bytes);

  /**
   * Update by pushing new bytes into the data buffer with "len" new bytes from the array,
   * starting from bytes[offset]
   * 
   * @param bytes
   *          New bytes to add
   * @param offset
   *          Array offset
   * @param len
   *          Number of bytes to read from offset
   */
  public void pushBytes(byte[] bytes, int offset, int len);

  /**
   * Apply the hash function on the buffered data
   * 
   * @return Hash value for buffered data
   */
  public byte[] hash();

  /**
   * @return Name of hash strategy
   */
  public String getName();

  // TODO(marcus): remove getName() from interface and get it by reflection

}
